package com.ydc.ln.tutorial.gui.test.window;

import java.awt.Color;
import java.awt.FileDialog;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * 文件选择窗口
 * 
 * @author ydc
 * @date 下午11:05:03 2013-5-17
 */
public class FileDialogFrame extends Frame {
    /**
     * @Fields serialVersionUID
     */
    private static final long serialVersionUID = -2637890231844413432L;

    public static void main(String[] args) {
        FileDialogFrame fd01 = new FileDialogFrame("Frame and FileDialog Test");
        fd01.setSize(400, 300);
        fd01.setBackground(Color.WHITE);
        fd01.setVisible(true);
        fd01.showFileDialog();
    }

    public FileDialogFrame(String title) {
        super(title);
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }

    public void showFileDialog() {
        FileDialog fd = new FileDialog(this, "Dialog");
        fd.setVisible(true);
    }
}
